#include "readonlycurrencydelegate.h"

#include "mainwindow.h"

ReadOnlyCurrencyDelegate::ReadOnlyCurrencyDelegate(QObject* parent)
	: QStyledItemDelegate(parent)
{
}

QWidget* ReadOnlyCurrencyDelegate::createEditor(QWidget*, const QStyleOptionViewItem&, const QModelIndex&) const
{
	return 0;
}

void ReadOnlyCurrencyDelegate::setEditorData(QWidget*, const QModelIndex&) const
{
}

void ReadOnlyCurrencyDelegate::setModelData(QWidget*, QAbstractItemModel*, const QModelIndex&) const
{
}

void ReadOnlyCurrencyDelegate::updateEditorGeometry(QWidget*, const QStyleOptionViewItem&, const QModelIndex&) const
{
}

QString ReadOnlyCurrencyDelegate::displayText(const QVariant &value, const QLocale& locale) const
{
	return QString("$%L1").arg(QStyledItemDelegate::displayText(value, locale).toDouble(), 0, 'f', 2).replace("$-", "-$");
}
